<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common-app/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>申请书编辑</title>
<script type="text/javascript" src="${res}/js/jquery/jquery.form.js"></script>
<script type="text/javascript"
	src="${res}/js/proposal/irisPrpPrepare.js"></script>
<script type="text/javascript"
	src="${res}/js/validate/irisvalidator.js"></script>
<script type="text/javascript"
	src="${res}/js/keyword/keywordtips.js"></script>	
<script type="text/javascript"
	src="${res_app}/js/app/proposal/irisPrpPrepare.js"></script>

<style>
	textarea{overflow:auto;}
</style>

<script type="text/javascript">
$(function(){
	queryflex();
});
/**
 * 申请书提交方法
 */


var ctxpath = "${ctx}";
var prcWin = new progressWin("${res}");//初始化遮罩层
/**
 * 页面初始化方法 所有的都定义在里面
 */
$(document).ready (function() {
	$("#wbox1").click(function() {
		check("check");
	});
	
	$("#wbox2").click(function() {
		
		check("check");
		
	});
/* 	$("table.t_css").not("[id='finances']").not("[id='checkbox_table_']").not("[id='budgetsMsg2']").not("[id='basicInfo']").each(function(){
		$(this).find("tr:even").addClass("li_1");
		$(this).find("tr:odd").addClass("li_2");
	}); */
	$("table").addClass("table01");
	$("#checkbox_table_").removeClass("table01");
	$("#feaReport_upload").removeClass("table01");
    $('div').find("[id^='checkbox_dyn_']").find("tr").removeClass("li_1").removeClass("li_2");
    $('div').find("[id^='checkbox_dyn_']").find("td").css("border",'0px solid');
	
	window.setInterval("checkPdfStatus()", "10000");//检验申请书的pdf
});

$(document).ready(function() {
	fileInit("feaReport_upload","PDF");
/* 	fileInit("prpContent_upload","JPG,PDF,TIFF,XLS,DOC,WPS",null,"{'JPG':'51200','PDF':'51200','TIFF':'51200','XLS':'51200','DOC':'51200','WPS':'51200'}");	
 */ 
	fileInit("prpContent_upload","JPG,PDF,DOC,DOCX,WPS",null,"");	
 //fileInitAttach("attachAdd", "JPG,PDF", null, 20, "{'JPG':'3072','PDF':'3072'}");
	$("#prpContent_upload").find(".file").hide();//隐藏文本框
});


$(document).ready(function() {
	$("#org").attr("disabled","true");
	initDepartForComplete("org");
	 initControl();
});

/**
 * 申报日期默认为当前日期
 */
$(document).ready(function() {


	var nowDate = '${sercverSysDate1}';
    if($("#submit_date").val()==""){
	   $("#submit_date").val(nowDate);
    }

});

/**
 * 填写检查
 */
function check(type){

	setTotalAmt();
	
	validate($("#fragment-tab1"),"");
	validateByTabRow($("#tblMileStones"),"孵化器现有情况-->科技企业孵化器现有工作人员一览表",1);
	validateByTabRow1($("#tblAttendOrg"),"孵化器现有情况-->科技企业孵化器现有孵化场地情况表",1);
	validate($("#zclkjvl"),"");
	var zijin = $("#zijin").val();
	if(zijin==""){
		zijin=0;
	}
	var zhengfubokuan = $("#zhengfubokuan").val();
	if(zhengfubokuan==""){
		zhengfubokuan=0;
	}
	var ziyouzijin = $("#ziyouzijin").val();
	if(ziyouzijin==""){
		ziyouzijin=0;
	}
	var qitalaiyuan = $("#qitalaiyuan").val();
	if(qitalaiyuan==""){
		qitalaiyuan=0;
	}
	if(parseFloat(zijin)!=(parseFloat(zhengfubokuan)+parseFloat(ziyouzijin)+parseFloat(qitalaiyuan))){
		irisValaddMsg("孵化器现有孵化服务设施及支持措施-->2、科技企业孵化器种子（孵化）资金设立情况表-->其中各项之和必须等于种子（孵化）资金总额");
	}
	validate($("#qingkuangbiao"),"");
	
	
	
	validateByTabRow($("#tblMileStones9"),"孵化器现有孵化服务设施及支持措施-->科技企业孵化器种子（孵化）资金设立情况表-->种子（孵化）资金支持在孵企业项目情况",0);
	validate($("#kjho"),"");
	validateByTabRow($("#tblMileStones2"),"孵化器现有孵化服务设施及支持措施-->3．科技企业孵化器现有公共服务平台情况表-->（1）已建或在建的公共技术服务平台名称（如实验室和测试中心等）",0);
	validateByTabRow($("#tblMileStones3"),"孵化器现有孵化服务设施及支持措施-->3．科技企业孵化器现有公共服务平台情况表-->（2）引入的科技中介服务机构",0);
	validateByTabRow($("#tblMileStones4"),"孵化器现有孵化服务设施及支持措施-->3．科技企业孵化器现有公共服务平台情况表-->（3）引入的投资机构",0);
	validateByTabRow($("#tblAttendOrg1"),"孵化器在孵与毕业企业情况-->1、科技企业孵化器在孵企业一览表",20);
	validateByTabRow($("#tblAttendOrg2"),"孵化器在孵与毕业企业情况-->2、科技企业孵化器毕业企业一览表",5);
	validateByTabRow($("#tblMileStones7"),"孵化器在孵与毕业企业情况-->3、科技企业孵化器毕业企业情况对照说明",5);
	validate($("#aldskjf"),"");
	

	/* 
	validateByTabRow($("#tbguishudi"),"项目情况-->项目核心技术获得知识产权情况",0);
	validate($("#tbguishudi1"),""); */

	function validateByTabRow1(obj, title, rowNum) {
		if ((obj.find("tr[id!='tr_heji']").length - 3) < rowNum)
			irisValaddMsg(messageTip.rowNum.replace("[name]", title).replace(
					"[num]", rowNum));
		obj.find("tr[id!='tr_heji']").each(
				function(index) {

					if (index >= 3) {
						rtitle = messageTip.rowIndex.replace("[name]", title)
								.replace("[index]", index - 2);
						validate($(this), rtitle);
					}
				});
	}

	
	
	if (irisJqValEmpty2($("#performances"),"项目成果-->预期绩效目标请完整填写") == 0)
	{
		validate($("#performances"),"项目成果-->预期绩效目标");
	}
	

   prp_attach();
   if(!valResult()){
		irisValShowMsg($("#wbox1"));
		return false;
	}
	if(type=="check"){
		showBox($("#wbox1"), "300px", "200px", "检查通过","1:所有检查全部合格");
	}
	return true;
}

	/**
	 * 验证table里有空就完整填写 针对表格里都为必添 例:irisJqValEmpty("tabid","项目经费请完整填写");
	 */
	function irisJqValEmpty2(obj, msg) {
		
		var sum=0;
		obj.find(":input,textarea").not("input[name='performances/summary_hidden']").each(function() {
			if($(this).val()==''){
				sum+=1;
			}
		});
		if(sum!=0)
		irisValaddMsg(msg);
		
		return sum;
	}

	 


function setTotalAmt(){
	/* $('#total_amt').val($("#input_total").val()); */
	$('#request_amt').val($("#total_invest_0").val());
}

</script>
<style>
	textarea{overflow:   auto;}
</style>
</head>
<body>

	<c:set var="xmlstr" value="${xmlData}" />
	<x:parse xml="${xmlstr}" var="xmlData" scope="request"/>
	<input type="hidden" id="childDiv" class="thickbox"/>
	<input type="hidden" id="filePath" value="${ctx}/file/ajax-filedownload?fileCode=" />
	<input type="hidden" id="menuId" value="${param.menuId}" />
	<input type="hidden" id="sysDate" value="${sercverSysDate}" />
	
	<div id="showMessage"></div>
	<div id="content">
		<cpt:helpTips key="prpedit" id="prpEditTips"></cpt:helpTips>
		<div class="clear_h15"></div>
		<div class="word_box" id="mainDiv">
			  <!-- 公用的配置界面 ：保存、提交等button-->
		    <jsp:include page="./prpeditmain_public_first.jsp"></jsp:include>
			<div class="bar_b">
				<input type="hidden" id="pdfStatus" value="${pdfStatus}" />
				<span class="right">版本号：<span name="proposal/prp_version" id="prp_version"><x:out select="$xmlData/data/proposal/prp_version" /></span></span>
			</div>
			<form method="post" id="mainForm">
				<input type="hidden" value="${grantCode}" id="grantCode" name="grantCode"> 
				
				<input type="hidden" value="${sub_grant_code}" id="sub_grant_code" name="sub_grant_code">
				<c:set var="nature_value"><x:out select="$xmlData/data/organizations/organization[@submit_org='1']/nature_value" /> </c:set>
				<input type="hidden" value="${posCode}" id="posCode" name="posCode"> 
				<input type="hidden" value="<iris:des3 code="${posCode}"></iris:des3>" id="posCodeDes" name="posCodeDes">
				<input type="hidden" value="<iris:des3 code="${fbl.pdfCode}"></iris:des3>" id="pdfCodeDes" name="pdfCodeDes">  
				<input type="hidden" value="${xmlData}" id="xmlData" name="xmlData">
				<input type="hidden" value="${fbl.pdfCode}" id="pdfCode" name="pdfCode"> 
				<input type="hidden" value="${flag_shizhi}" id="flag_shizhi" name="proposal/flag_shizhi"> 				
			</form>
				<div class="word_title">
				<c:set var="statYear">${statYear}</c:set>
				<c:if test="${empty statYear}">
					<c:set var="statYear"><x:out select="$xmlData/data/proposal/stat_year" /></c:set>
				</c:if>
				<input type="hidden" name="proposal/stat_year" value="${statYear}">
				<span name="proposal/grant_name" ><x:out select="$xmlData/data/proposal/grant_name" /></span>-项目申请书 (<span name="proposal/stat_year">${statYear}</span>年)<br />	
				(<x:out select="$xmlData/data/proposal/sub_grant_name" />) 
				 <!-- 公用的配置界面 -->
				    <jsp:include page="./prpeditmain_public.jsp"></jsp:include>
				</div>
				<div id="tabnav">
					<ul>
						<li class="down" id="tab1" onclick="changeTab(this.id)">
						    <a href="###"><span>孵化器基本概况</span></a>
						</li>
						<li  id="tab2" onclick="changeTab(this.id)">
						    <a href="###"><span>孵化器现有情况</span></a>
						</li>
						<li id="tab3" onclick="changeTab(this.id)" >
						    <a href="###"><span>孵化器现有孵化服务设施及支持措施</span></a>
						</li>
						
						<li id="tab4" onclick="changeTab(this.id)" >
						    <a href="###"><span>孵化器在孵与毕业企业情况</span></a>
						</li>
					
						<li id="tab5" onclick="changeTab(this.id)" >
						    <a href="###"><span>附件清单</span></a>
						</li>	
						
					</ul>
				</div>
				
				<div class="tab_box" id="fragment-tab1">
					<jsp:include page="../info/prpInfoEdit_fhqrd_2016.jsp">
					<jsp:param value="${statYear}" name="statYear" />
					<jsp:param value="孵化器基本概况" name="title"/>
					</jsp:include>
				</div>
				<div class="tab_box" id="fragment-tab2" style="display: none">
					<jsp:include page="../milestone/prpmilestoneedit_fhqrd_2016.jsp">
						<jsp:param value="孵化器现有情况" name="title" />
					</jsp:include>
				</div>
				<div class="tab_box" id="fragment-tab3" style="display: none">
					<jsp:include page="../goal/prpgoaledit_fhqrd_2016.jsp">
					   <jsp:param value="孵化器现有孵化服务设施及支持措施" name="title" />
					</jsp:include>
				</div>
				<div class="tab_box" id="fragment-tab4" style="display: none">					
					<jsp:include page="../milestone/prpmilestoneedit_fhqrd_1_2016.jsp">
						<jsp:param value="孵化器在孵与毕业企业情况" name="title" />
					</jsp:include>
				</div>
				<div class="tab_box" id="fragment-tab5" style="display: none">
					<jsp:include page="../attach/prpAttachEdit_by_public_2016.jsp">
					    <jsp:param value="${xmlstr}" name="xmlstr" />
					</jsp:include>
				</div>
				
				
			<!-- 公用的配置界面 ：保存、提交等button -->
			<jsp:include page="./prpeditmain_public_last.jsp"></jsp:include>
		</div>
		<div class="clear_h15"></div>
	</div>
</body>

</html>